package com.baorant.streamreceiver.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.stereotype.Service;

@Service
@EnableBinding(IReceiverService.class)
public class ReceiverService {
    private static final Logger logger = LoggerFactory.getLogger(ReceiverService.class);

    @StreamListener("log-exchange")
    public void onReceive(byte[] msg) {
        logger.info("消费者收到消息：" + new String(msg));
        System.out.println("消费者收到消息：" + new String(msg));
    }
}
